<?php
$this->breadcrumbs=array(
    Yii::t('site','Posts')=>array('index'),
    Yii::t('site','Manage'),
);
$this->menu=array(
    array('label'=>Yii::t('site','All Items'),'items'=>array(
        array('label'=>Yii::t('site','Create New Post'), 'url'=>array('create')),
    )),
);
?>

<h1><?php echo CHtml::encode(Yii::t('site','Manage Posts')); ?></h1>

<?php echo CHtml::form(null,'get',array('id'=>'updateItems')); ?>
<?php echo CHtml::hiddenField('r','post/admin'); ?>
<?php echo CHtml::hiddenField('command',''); ?>

<?php $this->widget('zii.widgets.grid.CGridView', array(
    'dataProvider'=>$model->search(),
    'filter'=>$model,
    'rowCssClass' => array('rowTop'),
    'summaryCssClass' => 'gridViewSummary',
    'template' => "{summary}\n{pager}\n{items}\n{pager}",
    'htmlOptions' => array(
        //'style' => 'width: 1200px'
    ),
    'selectableRows' => 2,
    'afterAjaxUpdate'=>'fixHeaders',
    'columns'=>array(
        array(
            'class' => 'CCheckBoxColumn',
            'id' => 'Post_id',
        ),
        array(
            'class'=>'CButtonColumn',
        ),
        array(
            'header'=>Yii::t('site','Export'),
            'type'=>'raw',
            'value'=>'CHtml::link(\'SQL\',array(\'exportDBChangeScript\',\'id\'=>$data->id))',
        ),
        array(
            'name'=>'title',
            'type'=>'raw',
            'value'=>'CHtml::link(CHtml::encode($data->title), $data->url)'
        ),
        array(
            'name'=>'status',
            'value'=>'Lookup::item("PostStatus",$data->status)',
            'filter'=>Lookup::items('PostStatus'),
        ),
        array(
            'name'=>'create_time',
            'type'=>'raw',
            'value'=>'Yii::app()->dateFormatter->formatDateTime($data->create_time,"medium","short")',
            'filter'=>false,
        ),
        array(
            'name'=>'update_time',
            'type'=>'raw',
            'value'=>'Yii::app()->dateFormatter->formatDateTime($data->update_time,"medium","short")',
            'filter'=>false,
        ),
    ),
)); ?>
<div class="actionBar">
    <?php echo CHtml::label('Change Status','newStatus'); ?>
    <?php echo CHtml::dropDownList('newStatus','',Lookup::items('PostStatus'),array('empty'=>Yii::t('site','(Select)'))); ?>
    <?php echo CHtml::button(Yii::t('site','Update'),array('type'=>'button','onclick'=>'jQuery("#command").val("updateStatus");jQuery("#updateItems").submit();')); ?>
</div>
<?php echo CHtml::endForm(); ?>

